<template>
  <div class="hotSearch">
    <p class="title">热门搜索</p>
    <ul class="hotList">
      <!-- <li
        v-for="(item, index) in hotSearchList"
        :key="index"
        @click="$emit('hotsearch', item.first)"
      >
        {{ item.first }}
      </li> -->
      <li
        v-for="(item, index) in hotSearchList"
        :key="index"
        @click="$emit('hotsearch', item.searchWord)"
      >
        {{ item.searchWord }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hotSearchList: [],
    };
  },
  created() {
    // 获取热搜
    this.$http.get("/search/hot/detail").then((d) => {
      // this.hotSearchList = d.data.result.hots;
      this.hotSearchList = d.data.data.slice(0, 10);
    });
  },
};
</script>

<style lang="less" scoped>
.hotSearch {
  padding: 15px 10px 0;
  .title {
    font-size: 12px;
    line-height: 12px;
    color: #666;
  }
  .hotList {
    margin: 10px 0 7px;
    li {
      display: inline-block;
      position: relative;
      height: 32px;
      margin-right: 8px;
      margin-bottom: 8px;
      padding: 0 14px;
      font-size: 14px;
      line-height: 32px;
      color: #333;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 90%;
      &::after {
        content: "";
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        box-sizing: border-box;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 32px;
      }
    }
  }
}
</style>